<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ attribute name="url" type="java.lang.String" required="true" description="修改url"%>
<%@ attribute name="title" type="java.lang.String" required="true" description="内容title"%>
<%@ attribute name="id" type="java.lang.String" required="true" description="id"%>
<%@ attribute name="urlParam" type="java.lang.String" required="false" description="补充参数"%>
<button class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="left" onclick="edit()" title="修改"><i class="fa fa-file-text-o"></i> 修改</button>


<script type="text/javascript">
    $(document).ready(function() {
        $('#contentTable thead tr th input.i-checks').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
            $('#contentTable tbody tr td input.i-checks').iCheck('check');
        });

        $('#contentTable thead tr th input.i-checks').on('ifUnchecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
            $('#contentTable tbody tr td input.i-checks').iCheck('uncheck');
        });

    });

    function edit(){

        var size = $("#contentTable tbody tr td input.i-checks:checked").size();
        if(size == 0 ){
            top.layer.alert('请至少选择一条数据!', {icon: 0, title:'警告'});
            return;
        }

        if(size > 1 ){
            top.layer.alert('只能选择一条数据!', {icon: 0, title:'警告'});
            return;
        }
        var id =  $("#contentTable tbody tr td input.i-checks:checkbox:checked").attr("id");

        openDialog("修改"+'${title}',"${url}?id="+id + "${urlParam}","800px", "500px","");
    }
</script><!-- 编辑按钮 -->
